#!/usr/bin/env python3
# -*- coding: utf-8 -*-

"""
@AUTHOR: tyc
@VERSION: 1.0.0
@DESCRIPTION: 搜索内容
@time: 2021-06-27 11:29:04 
"""

# 安装 打开terminal--->pip install requests
import urllib.request

import requests
query = input("输入搜索内容")
url = f'https://www.sogou.com/sie?query=%{query}'

header = {
    "User-Agent": 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.114 Safari/537.36'
}
resp = requests.get(url, headers=header)
print(resp)
print(resp.text)
with open(query+".html","w",encoding='utf-8') as f:
    f.write(resp.text)
resp.close()
